import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'member_center/swiper_center.dart';

class MemberCenterPage extends StatefulWidget {
  @override
  _MemberCenterPageState createState() => _MemberCenterPageState();
}

class _MemberCenterPageState extends State<MemberCenterPage> {
  @override
  Widget build(BuildContext context) {
    return Theme(
      data: ThemeData(
          brightness:Brightness.dark
      ),
      child: Scaffold(
        appBar: AppBar(
          title: Text(
            '会员中心',
            style: TextStyle(

                fontSize: 30.sp,
                fontWeight: FontWeight.bold),
          ),
          centerTitle: true,
          elevation: 0,
        ),
        body: CustomScrollView(
          physics: BouncingScrollPhysics(),
          slivers: [
            SliverToBoxAdapter(
              child: Container(
                decoration: BoxDecoration(color: Colors.black38),
                height: 400.w,
                padding: EdgeInsets.symmetric(vertical: 50.w),
                child: Swiper(
                  itemBuilder: (BuildContext context, int index) {
                    return Container(
                      width: 300.w,
                      padding: EdgeInsets.only(left: 30.w),
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(15.w)),
                          image: DecorationImage(
                              fit: BoxFit.cover,
                              image: NetworkImage(
                                  "http://himg2.huanqiu.com/attachment2010/2012/0607/20120607092018173.jpg"))),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: [
                          Text('钻石会员',style: TextStyle(
                              fontSize: 50.sp
                          ),),
                          Text('可享受商品折扣100折'),
                          Text('该会员等级尚未解锁')
                        ],
                      ),
                    );
                  },
                  itemCount: 4,
                  viewportFraction: 0.8,
                  scale: 0.9,
                ),
              ),
            ),
            SliverToBoxAdapter(
              child: SwiperCenter(),
            )
          ],
        ),
      ),
    );
  }
}
